package com.pulisher.mapper;

import com.pulisher.bean.PlayChapterBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Create 2023/9/11 20:53
 */
public interface PlayChapterMapper {

    //1、各章节播放统计
    @Select("select chapter_name,\n" +
            "       sum(video_play_ct) video_play_ct,\n" +
            "       sum(dur_time) dur_time,\n" +
            "       sum(user_ct) user_ct,\n" +
            "       CAST(sum(dur_time)/sum(user_ct) AS decimal(16,2)) per_time\n" +
            "from dws_play_chapter_play_window partition(par${date})\n" +
            "group by chapter_name;")
    public List<PlayChapterBean> selectPlayChapter(@Param("date") String date);
}
